namespace java ServicesAccessData

struct StatusPOJO {
    1: optional string statusID,
    2: required string content,
    3: optional string createDate,
    4: optional string modifyDate,
    5: required i32 likeCount = 0,
    6: required i32 dislikeCount = 0,
    7: required bool isPublic,
    8: optional string tags="",
}


struct TagPOJO {
    1: required string tagName,
    2: optional string createDate,
    3: optional string modifyDate,
    4: required bool isPublic,
    5: optional list<string> listStatusID,
}

struct TagNameAndCounter{
    1: required string tagName,
    2: required i32 numberStatus,
}

struct CounterPOJO {
   1: required i32 counterTag,
   2: required i32 counterStatus,   
}

struct UserPOJO {
   1: required string userID,
   2: required bool isBanned,
   3: required bool isAdmin,
   4: optional string createDate,
   5: optional list<string> listFavoriteStatusID,    
}

struct UserAdminPOJO{
   1: required string userID,
   2: required string passWord,
}

struct userLog {
   1: required string userID,
   2: required string userName,
   3: required string timeLogin,
}

struct favoriteLog {
   1: required string userID,
   2: required string userName,
   3: required string statusID,
   4: required string timeSavefav,
}


service Admin{
    bool insertStatus (1: StatusPOJO status)
    bool updateContentStatus (1: string statusID, 2: string content)
    bool updateTagsOnAStatus(1: string statusID, 2: string tags)
    i32 updateTagsOnListStatus(1: list<string> listStatusID, 2: string tags)
    bool updateIsPublicOnAStatus(1: string statusID, 2: bool state)
    i32 updateIsPublicOnListStatus(1: list<string> listStatusID, 2: bool state)
    bool deleteStatus (1: string statusID)
    i32 deleteListStatus (1: list<string> listStatusID)
    StatusPOJO selectStatusWithID(1: string statusID)
    list<StatusPOJO> selectAllStatus()
    list<StatusPOJO> selectStatusFromTag(1: string tagName)
    list<string> getListPaging (1: i32 limit)
    list<StatusPOJO> selectStatusFromPage (1: string startKey, 2: i32 limit)

    list<string> getListPagingOnATag (1: string tagName, 2: i32 limit)
    list<StatusPOJO> selectStatusFromPageOnATag (1: string tagName, 2: string startKey, 3: i32 limit)

    list<StatusPOJO> searchStatusByContent(1: string keyWord, 2: string _start, 3: string _end, 4: string filter)
    list<StatusPOJO> searchStatusByTag(1: string keyWord, 2: string _start, 3: string _end, 4: string filter)
    list<StatusPOJO> searchStatusByContentandTag(1: string keyWord,2: string tag, 3: string _start, 4: string _end, 5: string filter)
    i32 getTotal_searchStatusByContent(1: string keyWord, 2: string filter)
    i32 getTotal_searchStatusByTag(1: string keyWord, 2: string filter)
    i32 getTotal_searchStatusByContentandTag(1: string keyWord, 2: string tag, 3: string filter)



    TagPOJO selectTagWithTagName(1: string tagName)
    list<TagPOJO> selectAllTag()
    bool updateIsPublicOnATag(1: string tagName, 2: bool state)
    i32 updateIsPublicOnListTag(1: list<string> listTagNane, 2: bool state)
    bool insertStatusIntoTag(1: string tagName, 2: string statusID)
    bool removeStatusFromTag(1: string tagName, 2: string statusID)
    bool insertTag (1: string tagName, 2: bool state)
    bool deleteTag (1: string tagName)
    bool deleteListTag (1: list<string> listTagName)
    list<TagPOJO> searchTags(1: string value, 2: string _start, 3: string _end, 4: string filter)
    i32 getTotal_searchTags(1: string value, 2: string filter)

    UserPOJO selectInfoOfUser(1: string userID)
    bool updateIsBannedOnAUser(1: string userID, bool state)
    i32 updateIsBannedOnListUser(1: list<string> listUserID, bool state)
    list<UserPOJO> selectAllUserBanned()
    bool isAdminUser(1: string userID)
    bool updateIsAdminOnAUser(1: string userID, 2: bool state)
    bool updateIsAdminOnListUser(1: list<string> listUserID, 2: bool state)
    list<UserPOJO> selectListAdminUser()
    list<string> getListPagingUser (1: i32 limit)
    list<UserPOJO> selectListUserFromPage (1: string startKey, 2: i32 limit)

    bool setUserAdmin(1: string userID, 2: string passWord)
    bool removeUserAdmin(1: string userID)
    UserAdminPOJO getUserAdmin(1: string userID)
    list<UserAdminPOJO> getListUserAdminPOJO()
    
    CounterPOJO getCounter()

    list<userLog> getuserLog()
    bool setuserLog(1: string userID, 2: string userName)

    list<favoriteLog> getfavoriteLog()
    bool setfavoriteLog(1: string userID, 2: string userName, 3: string statusID)
    bool All_cache()
}


service User{
    bool likeStatus(1: string statusID)
    bool dislikeStatus(1: string statusID)
    
    list<StatusPOJO> selectStatusFromTag(1: string tagName)
    list<StatusPOJO> selectTopStatusFromTag(1: string tagName, 2: i32 limit)
    list<StatusPOJO> selectTopStatus(1: i32 limit)

    bool selectStatusFromTag_cache(1: string tagName)
    bool selectTopStatusFromTag_cache(1: string tagName)
    bool selectTopStatus_cache()
    bool selectAllTagNameAndCounter_cache()
    bool selectAllStatus_cache()

    list<StatusPOJO> selectRanDomStatus(1: i32 limit)
    list<StatusPOJO> selectRandomStatusFromTag(1: string tagName, 2: i32 limit)

    list<TagNameAndCounter> selectAllTagNameAndCounter()
    list<TagNameAndCounter> selectTagNameAndCounter(1: i32 limit)

    bool isAdminUser(1: string userID)
    bool isBannedUser(1: string userID)
    list<StatusPOJO> selectFavoriteStatus(1: string userID)
    bool insertFavoriteStatus(1: string userID, 2: string statusID)
    bool removeFavoriteStatus(1: string userID, 2: string statusID)
}
